// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate gtype;
extern crate iam_v1;
extern crate lazy_static;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// A billing account in the
/// [Google Cloud Console](https://console.cloud.google.com/). You can assign a
/// billing account to one or more projects.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BillingAccount {
    /// Output only. The resource name of the billing account. The resource name
    /// has the form `billingAccounts/{billing_account_id}`. For example,
    /// `billingAccounts/012345-567890-ABCDEF` would be the resource name for
    /// billing account `012345-567890-ABCDEF`.
    pub name: std::string::String,

    /// Output only. True if the billing account is open, and will therefore be
    /// charged for any usage on associated projects. False if the billing account
    /// is closed, and therefore projects associated with it are unable to use paid
    /// services.
    pub open: bool,

    /// The display name given to the billing account, such as `My Billing
    /// Account`. This name is displayed in the Google Cloud Console.
    pub display_name: std::string::String,

    /// If this account is a
    /// [subaccount](https://cloud.google.com/billing/docs/concepts), then this
    /// will be the resource name of the parent billing account that it is being
    /// resold through.
    /// Otherwise this will be empty.
    pub master_billing_account: std::string::String,

    /// Output only. The billing account's parent resource identifier.
    /// Use the `MoveBillingAccount` method to update the account's parent resource
    /// if it is a organization.
    /// Format:
    ///
    /// - `organizations/{organization_id}`, for example,
    ///   `organizations/12345678`
    /// - `billingAccounts/{billing_account_id}`, for example,
    ///   `billingAccounts/012345-567890-ABCDEF`
    pub parent: std::string::String,

    /// Optional. The currency in which the billing account is billed and charged,
    /// represented as an ISO 4217 code such as `USD`.
    ///
    /// Billing account currency is determined at the time of billing account
    /// creation and cannot be updated subsequently, so this field should not be
    /// set on update requests. In addition, a subaccount always matches the
    /// currency of its parent billing account, so this field should not be set on
    /// subaccount creation requests. Clients can read this field to determine the
    /// currency of an existing billing account.
    pub currency_code: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl BillingAccount {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::BillingAccount::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [open][crate::model::BillingAccount::open].
    pub fn set_open<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.open = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::BillingAccount::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [master_billing_account][crate::model::BillingAccount::master_billing_account].
    pub fn set_master_billing_account<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.master_billing_account = v.into();
        self
    }

    /// Sets the value of [parent][crate::model::BillingAccount::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [currency_code][crate::model::BillingAccount::currency_code].
    pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.currency_code = v.into();
        self
    }
}

impl wkt::message::Message for BillingAccount {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.BillingAccount"
    }
}

/// Encapsulation of billing information for a Google Cloud Console project. A
/// project has at most one associated billing account at a time (but a billing
/// account can be assigned to multiple projects).
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ProjectBillingInfo {
    /// Output only. The resource name for the `ProjectBillingInfo`; has the form
    /// `projects/{project_id}/billingInfo`. For example, the resource name for the
    /// billing information for project `tokyo-rain-123` would be
    /// `projects/tokyo-rain-123/billingInfo`.
    pub name: std::string::String,

    /// Output only. The ID of the project that this `ProjectBillingInfo`
    /// represents, such as `tokyo-rain-123`. This is a convenience field so that
    /// you don't need to parse the `name` field to obtain a project ID.
    pub project_id: std::string::String,

    /// The resource name of the billing account associated with the project, if
    /// any. For example, `billingAccounts/012345-567890-ABCDEF`.
    pub billing_account_name: std::string::String,

    /// Output only. True if the project is associated with an open billing
    /// account, to which usage on the project is charged. False if the project is
    /// associated with a closed billing account, or no billing account at all, and
    /// therefore cannot use paid services.
    pub billing_enabled: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ProjectBillingInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ProjectBillingInfo::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [project_id][crate::model::ProjectBillingInfo::project_id].
    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.project_id = v.into();
        self
    }

    /// Sets the value of [billing_account_name][crate::model::ProjectBillingInfo::billing_account_name].
    pub fn set_billing_account_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.billing_account_name = v.into();
        self
    }

    /// Sets the value of [billing_enabled][crate::model::ProjectBillingInfo::billing_enabled].
    pub fn set_billing_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.billing_enabled = v.into();
        self
    }
}

impl wkt::message::Message for ProjectBillingInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.ProjectBillingInfo"
    }
}

/// Request message for `GetBillingAccount`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetBillingAccountRequest {
    /// Required. The resource name of the billing account to retrieve. For
    /// example, `billingAccounts/012345-567890-ABCDEF`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetBillingAccountRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetBillingAccountRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetBillingAccountRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.GetBillingAccountRequest"
    }
}

/// Request message for `ListBillingAccounts`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListBillingAccountsRequest {
    /// Requested page size. The maximum page size is 100; this is also the
    /// default.
    pub page_size: i32,

    /// A token identifying a page of results to return. This should be a
    /// `next_page_token` value returned from a previous `ListBillingAccounts`
    /// call. If unspecified, the first page of results is returned.
    pub page_token: std::string::String,

    /// Options for how to filter the returned billing accounts.
    /// This only supports filtering for
    /// [subaccounts](https://cloud.google.com/billing/docs/concepts) under a
    /// single provided parent billing account.
    /// (for example,
    /// `master_billing_account=billingAccounts/012345-678901-ABCDEF`).
    /// Boolean algebra and other fields are not currently supported.
    pub filter: std::string::String,

    /// Optional. The parent resource to list billing accounts from.
    /// Format:
    ///
    /// - `organizations/{organization_id}`, for example,
    ///   `organizations/12345678`
    /// - `billingAccounts/{billing_account_id}`, for example,
    ///   `billingAccounts/012345-567890-ABCDEF`
    pub parent: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListBillingAccountsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [page_size][crate::model::ListBillingAccountsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListBillingAccountsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListBillingAccountsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [parent][crate::model::ListBillingAccountsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }
}

impl wkt::message::Message for ListBillingAccountsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.ListBillingAccountsRequest"
    }
}

/// Response message for `ListBillingAccounts`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListBillingAccountsResponse {
    /// A list of billing accounts.
    pub billing_accounts: std::vec::Vec<crate::model::BillingAccount>,

    /// A token to retrieve the next page of results. To retrieve the next page,
    /// call `ListBillingAccounts` again with the `page_token` field set to this
    /// value. This field is empty if there are no more results to retrieve.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListBillingAccountsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [billing_accounts][crate::model::ListBillingAccountsResponse::billing_accounts].
    pub fn set_billing_accounts<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::BillingAccount>,
    {
        use std::iter::Iterator;
        self.billing_accounts = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListBillingAccountsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListBillingAccountsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.ListBillingAccountsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListBillingAccountsResponse {
    type PageItem = crate::model::BillingAccount;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.billing_accounts
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for `CreateBillingAccount`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateBillingAccountRequest {
    /// Required. The billing account resource to create.
    /// Currently CreateBillingAccount only supports subaccount creation, so
    /// any created billing accounts must be under a provided parent billing
    /// account.
    pub billing_account: std::option::Option<crate::model::BillingAccount>,

    /// Optional. The parent to create a billing account from.
    /// Format:
    ///
    /// - `billingAccounts/{billing_account_id}`, for example,
    ///   `billingAccounts/012345-567890-ABCDEF`
    pub parent: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateBillingAccountRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [billing_account][crate::model::CreateBillingAccountRequest::billing_account].
    pub fn set_billing_account<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::BillingAccount>,
    {
        self.billing_account = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [billing_account][crate::model::CreateBillingAccountRequest::billing_account].
    pub fn set_or_clear_billing_account<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::BillingAccount>,
    {
        self.billing_account = v.map(|x| x.into());
        self
    }

    /// Sets the value of [parent][crate::model::CreateBillingAccountRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }
}

impl wkt::message::Message for CreateBillingAccountRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.CreateBillingAccountRequest"
    }
}

/// Request message for `UpdateBillingAccount`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateBillingAccountRequest {
    /// Required. The name of the billing account resource to be updated.
    pub name: std::string::String,

    /// Required. The billing account resource to replace the resource on the
    /// server.
    pub account: std::option::Option<crate::model::BillingAccount>,

    /// The update mask applied to the resource.
    /// Only "display_name" is currently supported.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateBillingAccountRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::UpdateBillingAccountRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [account][crate::model::UpdateBillingAccountRequest::account].
    pub fn set_account<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::BillingAccount>,
    {
        self.account = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [account][crate::model::UpdateBillingAccountRequest::account].
    pub fn set_or_clear_account<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::BillingAccount>,
    {
        self.account = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateBillingAccountRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateBillingAccountRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateBillingAccountRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.UpdateBillingAccountRequest"
    }
}

/// Request message for `ListProjectBillingInfo`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListProjectBillingInfoRequest {
    /// Required. The resource name of the billing account associated with the
    /// projects that you want to list. For example,
    /// `billingAccounts/012345-567890-ABCDEF`.
    pub name: std::string::String,

    /// Requested page size. The maximum page size is 100; this is also the
    /// default.
    pub page_size: i32,

    /// A token identifying a page of results to be returned. This should be a
    /// `next_page_token` value returned from a previous `ListProjectBillingInfo`
    /// call. If unspecified, the first page of results is returned.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListProjectBillingInfoRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ListProjectBillingInfoRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListProjectBillingInfoRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListProjectBillingInfoRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListProjectBillingInfoRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.ListProjectBillingInfoRequest"
    }
}

/// Request message for `ListProjectBillingInfoResponse`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListProjectBillingInfoResponse {
    /// A list of `ProjectBillingInfo` resources representing the projects
    /// associated with the billing account.
    pub project_billing_info: std::vec::Vec<crate::model::ProjectBillingInfo>,

    /// A token to retrieve the next page of results. To retrieve the next page,
    /// call `ListProjectBillingInfo` again with the `page_token` field set to this
    /// value. This field is empty if there are no more results to retrieve.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListProjectBillingInfoResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [project_billing_info][crate::model::ListProjectBillingInfoResponse::project_billing_info].
    pub fn set_project_billing_info<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ProjectBillingInfo>,
    {
        use std::iter::Iterator;
        self.project_billing_info = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListProjectBillingInfoResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListProjectBillingInfoResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.ListProjectBillingInfoResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListProjectBillingInfoResponse {
    type PageItem = crate::model::ProjectBillingInfo;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.project_billing_info
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for `GetProjectBillingInfo`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetProjectBillingInfoRequest {
    /// Required. The resource name of the project for which billing information is
    /// retrieved. For example, `projects/tokyo-rain-123`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetProjectBillingInfoRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetProjectBillingInfoRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetProjectBillingInfoRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.GetProjectBillingInfoRequest"
    }
}

/// Request message for `UpdateProjectBillingInfo`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateProjectBillingInfoRequest {
    /// Required. The resource name of the project associated with the billing
    /// information that you want to update. For example,
    /// `projects/tokyo-rain-123`.
    pub name: std::string::String,

    /// The new billing information for the project. Output-only fields are
    /// ignored; thus, you can leave empty all fields except
    /// `billing_account_name`.
    pub project_billing_info: std::option::Option<crate::model::ProjectBillingInfo>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateProjectBillingInfoRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::UpdateProjectBillingInfoRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [project_billing_info][crate::model::UpdateProjectBillingInfoRequest::project_billing_info].
    pub fn set_project_billing_info<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ProjectBillingInfo>,
    {
        self.project_billing_info = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [project_billing_info][crate::model::UpdateProjectBillingInfoRequest::project_billing_info].
    pub fn set_or_clear_project_billing_info<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ProjectBillingInfo>,
    {
        self.project_billing_info = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateProjectBillingInfoRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.UpdateProjectBillingInfoRequest"
    }
}

/// Request message for `MoveBillingAccount` RPC.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MoveBillingAccountRequest {
    /// Required. The resource name of the billing account to move.
    /// Must be of the form `billingAccounts/{billing_account_id}`.
    /// The specified billing account cannot be a subaccount, since a subaccount
    /// always belongs to the same organization as its parent account.
    pub name: std::string::String,

    /// Required. The resource name of the Organization to move
    /// the billing account under.
    /// Must be of the form `organizations/{organization_id}`.
    pub destination_parent: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MoveBillingAccountRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::MoveBillingAccountRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [destination_parent][crate::model::MoveBillingAccountRequest::destination_parent].
    pub fn set_destination_parent<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.destination_parent = v.into();
        self
    }
}

impl wkt::message::Message for MoveBillingAccountRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.MoveBillingAccountRequest"
    }
}

/// Encapsulates a single service in Google Cloud Platform.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Service {
    /// The resource name for the service.
    /// Example: "services/6F81-5844-456A"
    pub name: std::string::String,

    /// The identifier for the service.
    /// Example: "6F81-5844-456A"
    pub service_id: std::string::String,

    /// A human readable display name for this service.
    pub display_name: std::string::String,

    /// The business under which the service is offered.
    /// Ex. "businessEntities/GCP", "businessEntities/Maps"
    pub business_entity_name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Service {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Service::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [service_id][crate::model::Service::service_id].
    pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.service_id = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::Service::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [business_entity_name][crate::model::Service::business_entity_name].
    pub fn set_business_entity_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.business_entity_name = v.into();
        self
    }
}

impl wkt::message::Message for Service {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.Service"
    }
}

/// Encapsulates a single SKU in Google Cloud
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Sku {
    /// The resource name for the SKU.
    /// Example: "services/6F81-5844-456A/skus/D041-B8A1-6E0B"
    pub name: std::string::String,

    /// The identifier for the SKU.
    /// Example: "D041-B8A1-6E0B"
    pub sku_id: std::string::String,

    /// A human readable description of the SKU, has a maximum length of 256
    /// characters.
    pub description: std::string::String,

    /// The category hierarchy of this SKU, purely for organizational purpose.
    pub category: std::option::Option<crate::model::Category>,

    /// List of service regions this SKU is offered at.
    /// Example: "asia-east1"
    /// Service regions can be found at <https://cloud.google.com/about/locations/>
    pub service_regions: std::vec::Vec<std::string::String>,

    /// A timeline of pricing info for this SKU in chronological order.
    pub pricing_info: std::vec::Vec<crate::model::PricingInfo>,

    /// Identifies the service provider.
    /// This is 'Google' for first party services in Google Cloud Platform.
    pub service_provider_name: std::string::String,

    /// The geographic taxonomy for this sku.
    pub geo_taxonomy: std::option::Option<crate::model::GeoTaxonomy>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Sku {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Sku::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [sku_id][crate::model::Sku::sku_id].
    pub fn set_sku_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.sku_id = v.into();
        self
    }

    /// Sets the value of [description][crate::model::Sku::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [category][crate::model::Sku::category].
    pub fn set_category<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Category>,
    {
        self.category = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [category][crate::model::Sku::category].
    pub fn set_or_clear_category<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Category>,
    {
        self.category = v.map(|x| x.into());
        self
    }

    /// Sets the value of [service_regions][crate::model::Sku::service_regions].
    pub fn set_service_regions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.service_regions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [pricing_info][crate::model::Sku::pricing_info].
    pub fn set_pricing_info<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::PricingInfo>,
    {
        use std::iter::Iterator;
        self.pricing_info = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [service_provider_name][crate::model::Sku::service_provider_name].
    pub fn set_service_provider_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.service_provider_name = v.into();
        self
    }

    /// Sets the value of [geo_taxonomy][crate::model::Sku::geo_taxonomy].
    pub fn set_geo_taxonomy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::GeoTaxonomy>,
    {
        self.geo_taxonomy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [geo_taxonomy][crate::model::Sku::geo_taxonomy].
    pub fn set_or_clear_geo_taxonomy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::GeoTaxonomy>,
    {
        self.geo_taxonomy = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for Sku {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.Sku"
    }
}

/// Represents the category hierarchy of a SKU.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Category {
    /// The display name of the service this SKU belongs to.
    pub service_display_name: std::string::String,

    /// The type of product the SKU refers to.
    /// Example: "Compute", "Storage", "Network", "ApplicationServices" etc.
    pub resource_family: std::string::String,

    /// A group classification for related SKUs.
    /// Example: "RAM", "GPU", "Prediction", "Ops", "GoogleEgress" etc.
    pub resource_group: std::string::String,

    /// Represents how the SKU is consumed.
    /// Example: "OnDemand", "Preemptible", "Commit1Mo", "Commit1Yr" etc.
    pub usage_type: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Category {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [service_display_name][crate::model::Category::service_display_name].
    pub fn set_service_display_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.service_display_name = v.into();
        self
    }

    /// Sets the value of [resource_family][crate::model::Category::resource_family].
    pub fn set_resource_family<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.resource_family = v.into();
        self
    }

    /// Sets the value of [resource_group][crate::model::Category::resource_group].
    pub fn set_resource_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.resource_group = v.into();
        self
    }

    /// Sets the value of [usage_type][crate::model::Category::usage_type].
    pub fn set_usage_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.usage_type = v.into();
        self
    }
}

impl wkt::message::Message for Category {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.Category"
    }
}

/// Represents the pricing information for a SKU at a single point of time.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PricingInfo {
    /// The timestamp from which this pricing was effective within the requested
    /// time range. This is guaranteed to be greater than or equal to the
    /// start_time field in the request and less than the end_time field in the
    /// request. If a time range was not specified in the request this field will
    /// be equivalent to a time within the last 12 hours, indicating the latest
    /// pricing info.
    pub effective_time: std::option::Option<wkt::Timestamp>,

    /// An optional human readable summary of the pricing information, has a
    /// maximum length of 256 characters.
    pub summary: std::string::String,

    /// Expresses the pricing formula. See `PricingExpression` for an example.
    pub pricing_expression: std::option::Option<crate::model::PricingExpression>,

    /// Aggregation Info. This can be left unspecified if the pricing expression
    /// doesn't require aggregation.
    pub aggregation_info: std::option::Option<crate::model::AggregationInfo>,

    /// Conversion rate used for currency conversion, from USD to the currency
    /// specified in the request. This includes any surcharge collected for billing
    /// in non USD currency. If a currency is not specified in the request this
    /// defaults to 1.0.
    /// Example: USD * currency_conversion_rate = JPY
    pub currency_conversion_rate: f64,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl PricingInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [effective_time][crate::model::PricingInfo::effective_time].
    pub fn set_effective_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.effective_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [effective_time][crate::model::PricingInfo::effective_time].
    pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.effective_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [summary][crate::model::PricingInfo::summary].
    pub fn set_summary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.summary = v.into();
        self
    }

    /// Sets the value of [pricing_expression][crate::model::PricingInfo::pricing_expression].
    pub fn set_pricing_expression<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::PricingExpression>,
    {
        self.pricing_expression = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [pricing_expression][crate::model::PricingInfo::pricing_expression].
    pub fn set_or_clear_pricing_expression<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::PricingExpression>,
    {
        self.pricing_expression = v.map(|x| x.into());
        self
    }

    /// Sets the value of [aggregation_info][crate::model::PricingInfo::aggregation_info].
    pub fn set_aggregation_info<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::AggregationInfo>,
    {
        self.aggregation_info = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [aggregation_info][crate::model::PricingInfo::aggregation_info].
    pub fn set_or_clear_aggregation_info<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::AggregationInfo>,
    {
        self.aggregation_info = v.map(|x| x.into());
        self
    }

    /// Sets the value of [currency_conversion_rate][crate::model::PricingInfo::currency_conversion_rate].
    pub fn set_currency_conversion_rate<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
        self.currency_conversion_rate = v.into();
        self
    }
}

impl wkt::message::Message for PricingInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.PricingInfo"
    }
}

/// Expresses a mathematical pricing formula. For Example:-
///
/// `usage_unit: GBy`
/// `tiered_rates:`
/// `[start_usage_amount: 20, unit_price: $10]`
/// `[start_usage_amount: 100, unit_price: $5]`
///
/// The above expresses a pricing formula where the first 20GB is free, the
/// next 80GB is priced at $10 per GB followed by $5 per GB for additional
/// usage.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PricingExpression {
    /// The short hand for unit of usage this pricing is specified in.
    /// Example: usage_unit of "GiBy" means that usage is specified in "Gibi Byte".
    pub usage_unit: std::string::String,

    /// The recommended quantity of units for displaying pricing info. When
    /// displaying pricing info it is recommended to display:
    /// (unit_price * display_quantity) per display_quantity usage_unit.
    /// This field does not affect the pricing formula and is for display purposes
    /// only.
    /// Example: If the unit_price is "0.0001 USD", the usage_unit is "GB" and
    /// the display_quantity is "1000" then the recommended way of displaying the
    /// pricing info is "0.10 USD per 1000 GB"
    pub display_quantity: f64,

    /// The list of tiered rates for this pricing. The total cost is computed by
    /// applying each of the tiered rates on usage. This repeated list is sorted
    /// by ascending order of start_usage_amount.
    pub tiered_rates: std::vec::Vec<crate::model::pricing_expression::TierRate>,

    /// The unit of usage in human readable form.
    /// Example: "gibi byte".
    pub usage_unit_description: std::string::String,

    /// The base unit for the SKU which is the unit used in usage exports.
    /// Example: "By"
    pub base_unit: std::string::String,

    /// The base unit in human readable form.
    /// Example: "byte".
    pub base_unit_description: std::string::String,

    /// Conversion factor for converting from price per usage_unit to price per
    /// base_unit, and start_usage_amount to start_usage_amount in base_unit.
    /// unit_price / base_unit_conversion_factor = price per base_unit.
    /// start_usage_amount * base_unit_conversion_factor = start_usage_amount in
    /// base_unit.
    pub base_unit_conversion_factor: f64,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl PricingExpression {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [usage_unit][crate::model::PricingExpression::usage_unit].
    pub fn set_usage_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.usage_unit = v.into();
        self
    }

    /// Sets the value of [display_quantity][crate::model::PricingExpression::display_quantity].
    pub fn set_display_quantity<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
        self.display_quantity = v.into();
        self
    }

    /// Sets the value of [tiered_rates][crate::model::PricingExpression::tiered_rates].
    pub fn set_tiered_rates<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::pricing_expression::TierRate>,
    {
        use std::iter::Iterator;
        self.tiered_rates = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [usage_unit_description][crate::model::PricingExpression::usage_unit_description].
    pub fn set_usage_unit_description<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.usage_unit_description = v.into();
        self
    }

    /// Sets the value of [base_unit][crate::model::PricingExpression::base_unit].
    pub fn set_base_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.base_unit = v.into();
        self
    }

    /// Sets the value of [base_unit_description][crate::model::PricingExpression::base_unit_description].
    pub fn set_base_unit_description<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.base_unit_description = v.into();
        self
    }

    /// Sets the value of [base_unit_conversion_factor][crate::model::PricingExpression::base_unit_conversion_factor].
    pub fn set_base_unit_conversion_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
        self.base_unit_conversion_factor = v.into();
        self
    }
}

impl wkt::message::Message for PricingExpression {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.PricingExpression"
    }
}

/// Defines additional types related to [PricingExpression].
pub mod pricing_expression {
    #[allow(unused_imports)]
    use super::*;

    /// The price rate indicating starting usage and its corresponding price.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct TierRate {
        /// Usage is priced at this rate only after this amount.
        /// Example: start_usage_amount of 10 indicates that the usage will be priced
        /// at the unit_price after the first 10 usage_units.
        pub start_usage_amount: f64,

        /// The price per unit of usage.
        /// Example: unit_price of amount $10 indicates that each unit will cost $10.
        pub unit_price: std::option::Option<gtype::model::Money>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl TierRate {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [start_usage_amount][crate::model::pricing_expression::TierRate::start_usage_amount].
        pub fn set_start_usage_amount<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
            self.start_usage_amount = v.into();
            self
        }

        /// Sets the value of [unit_price][crate::model::pricing_expression::TierRate::unit_price].
        pub fn set_unit_price<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<gtype::model::Money>,
        {
            self.unit_price = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [unit_price][crate::model::pricing_expression::TierRate::unit_price].
        pub fn set_or_clear_unit_price<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<gtype::model::Money>,
        {
            self.unit_price = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for TierRate {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.billing.v1.PricingExpression.TierRate"
        }
    }
}

/// Represents the aggregation level and interval for pricing of a single SKU.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AggregationInfo {
    pub aggregation_level: crate::model::aggregation_info::AggregationLevel,

    pub aggregation_interval: crate::model::aggregation_info::AggregationInterval,

    /// The number of intervals to aggregate over.
    /// Example: If aggregation_level is "DAILY" and aggregation_count is 14,
    /// aggregation will be over 14 days.
    pub aggregation_count: i32,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl AggregationInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [aggregation_level][crate::model::AggregationInfo::aggregation_level].
    pub fn set_aggregation_level<
        T: std::convert::Into<crate::model::aggregation_info::AggregationLevel>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.aggregation_level = v.into();
        self
    }

    /// Sets the value of [aggregation_interval][crate::model::AggregationInfo::aggregation_interval].
    pub fn set_aggregation_interval<
        T: std::convert::Into<crate::model::aggregation_info::AggregationInterval>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.aggregation_interval = v.into();
        self
    }

    /// Sets the value of [aggregation_count][crate::model::AggregationInfo::aggregation_count].
    pub fn set_aggregation_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.aggregation_count = v.into();
        self
    }
}

impl wkt::message::Message for AggregationInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.AggregationInfo"
    }
}

/// Defines additional types related to [AggregationInfo].
pub mod aggregation_info {
    #[allow(unused_imports)]
    use super::*;

    /// The level at which usage is aggregated to compute cost.
    /// Example: "ACCOUNT" aggregation level indicates that usage for tiered
    /// pricing is aggregated across all projects in a single account.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum AggregationLevel {
        Unspecified,
        Account,
        Project,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [AggregationLevel::value] or
        /// [AggregationLevel::name].
        UnknownValue(aggregation_level::UnknownValue),
    }

    #[doc(hidden)]
    pub mod aggregation_level {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl AggregationLevel {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Account => std::option::Option::Some(1),
                Self::Project => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("AGGREGATION_LEVEL_UNSPECIFIED"),
                Self::Account => std::option::Option::Some("ACCOUNT"),
                Self::Project => std::option::Option::Some("PROJECT"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for AggregationLevel {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for AggregationLevel {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for AggregationLevel {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Account,
                2 => Self::Project,
                _ => Self::UnknownValue(aggregation_level::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for AggregationLevel {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "AGGREGATION_LEVEL_UNSPECIFIED" => Self::Unspecified,
                "ACCOUNT" => Self::Account,
                "PROJECT" => Self::Project,
                _ => Self::UnknownValue(aggregation_level::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for AggregationLevel {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Account => serializer.serialize_i32(1),
                Self::Project => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for AggregationLevel {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AggregationLevel>::new(
                ".google.cloud.billing.v1.AggregationInfo.AggregationLevel",
            ))
        }
    }

    /// The interval at which usage is aggregated to compute cost.
    /// Example: "MONTHLY" aggregation interval indicates that usage for tiered
    /// pricing is aggregated every month.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum AggregationInterval {
        Unspecified,
        Daily,
        Monthly,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [AggregationInterval::value] or
        /// [AggregationInterval::name].
        UnknownValue(aggregation_interval::UnknownValue),
    }

    #[doc(hidden)]
    pub mod aggregation_interval {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl AggregationInterval {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Daily => std::option::Option::Some(1),
                Self::Monthly => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("AGGREGATION_INTERVAL_UNSPECIFIED"),
                Self::Daily => std::option::Option::Some("DAILY"),
                Self::Monthly => std::option::Option::Some("MONTHLY"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for AggregationInterval {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for AggregationInterval {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for AggregationInterval {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Daily,
                2 => Self::Monthly,
                _ => Self::UnknownValue(aggregation_interval::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for AggregationInterval {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "AGGREGATION_INTERVAL_UNSPECIFIED" => Self::Unspecified,
                "DAILY" => Self::Daily,
                "MONTHLY" => Self::Monthly,
                _ => Self::UnknownValue(aggregation_interval::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for AggregationInterval {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Daily => serializer.serialize_i32(1),
                Self::Monthly => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for AggregationInterval {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AggregationInterval>::new(
                ".google.cloud.billing.v1.AggregationInfo.AggregationInterval",
            ))
        }
    }
}

/// Encapsulates the geographic taxonomy data for a sku.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GeoTaxonomy {
    /// The type of Geo Taxonomy: GLOBAL, REGIONAL, or MULTI_REGIONAL.
    pub r#type: crate::model::geo_taxonomy::Type,

    /// The list of regions associated with a sku. Empty for Global skus, which are
    /// associated with all Google Cloud regions.
    pub regions: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GeoTaxonomy {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [r#type][crate::model::GeoTaxonomy::type].
    pub fn set_type<T: std::convert::Into<crate::model::geo_taxonomy::Type>>(
        mut self,
        v: T,
    ) -> Self {
        self.r#type = v.into();
        self
    }

    /// Sets the value of [regions][crate::model::GeoTaxonomy::regions].
    pub fn set_regions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.regions = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for GeoTaxonomy {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.GeoTaxonomy"
    }
}

/// Defines additional types related to [GeoTaxonomy].
pub mod geo_taxonomy {
    #[allow(unused_imports)]
    use super::*;

    /// The type of Geo Taxonomy: GLOBAL, REGIONAL, or MULTI_REGIONAL.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Type {
        /// The type is not specified.
        Unspecified,
        /// The sku is global in nature, e.g. a license sku. Global skus are
        /// available in all regions, and so have an empty region list.
        Global,
        /// The sku is available in a specific region, e.g. "us-west2".
        Regional,
        /// The sku is associated with multiple regions, e.g. "us-west2" and
        /// "us-east1".
        MultiRegional,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Type::value] or
        /// [Type::name].
        UnknownValue(r#type::UnknownValue),
    }

    #[doc(hidden)]
    pub mod r#type {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Type {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Global => std::option::Option::Some(1),
                Self::Regional => std::option::Option::Some(2),
                Self::MultiRegional => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
                Self::Global => std::option::Option::Some("GLOBAL"),
                Self::Regional => std::option::Option::Some("REGIONAL"),
                Self::MultiRegional => std::option::Option::Some("MULTI_REGIONAL"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Type {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Type {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Type {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Global,
                2 => Self::Regional,
                3 => Self::MultiRegional,
                _ => Self::UnknownValue(r#type::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Type {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "TYPE_UNSPECIFIED" => Self::Unspecified,
                "GLOBAL" => Self::Global,
                "REGIONAL" => Self::Regional,
                "MULTI_REGIONAL" => Self::MultiRegional,
                _ => Self::UnknownValue(r#type::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Type {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Global => serializer.serialize_i32(1),
                Self::Regional => serializer.serialize_i32(2),
                Self::MultiRegional => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Type {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
                ".google.cloud.billing.v1.GeoTaxonomy.Type",
            ))
        }
    }
}

/// Request message for `ListServices`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListServicesRequest {
    /// Requested page size. Defaults to 5000.
    pub page_size: i32,

    /// A token identifying a page of results to return. This should be a
    /// `next_page_token` value returned from a previous `ListServices`
    /// call. If unspecified, the first page of results is returned.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListServicesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListServicesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.ListServicesRequest"
    }
}

/// Response message for `ListServices`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListServicesResponse {
    /// A list of services.
    pub services: std::vec::Vec<crate::model::Service>,

    /// A token to retrieve the next page of results. To retrieve the next page,
    /// call `ListServices` again with the `page_token` field set to this
    /// value. This field is empty if there are no more results to retrieve.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListServicesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [services][crate::model::ListServicesResponse::services].
    pub fn set_services<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Service>,
    {
        use std::iter::Iterator;
        self.services = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListServicesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListServicesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.ListServicesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListServicesResponse {
    type PageItem = crate::model::Service;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.services
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request message for `ListSkus`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListSkusRequest {
    /// Required. The name of the service.
    /// Example: "services/6F81-5844-456A"
    pub parent: std::string::String,

    /// Optional inclusive start time of the time range for which the pricing
    /// versions will be returned. Timestamps in the future are not allowed.
    /// The time range has to be within a single calendar month in
    /// America/Los_Angeles timezone. Time range as a whole is optional. If not
    /// specified, the latest pricing will be returned (up to 12 hours old at
    /// most).
    pub start_time: std::option::Option<wkt::Timestamp>,

    /// Optional exclusive end time of the time range for which the pricing
    /// versions will be returned. Timestamps in the future are not allowed.
    /// The time range has to be within a single calendar month in
    /// America/Los_Angeles timezone. Time range as a whole is optional. If not
    /// specified, the latest pricing will be returned (up to 12 hours old at
    /// most).
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// The ISO 4217 currency code for the pricing info in the response proto.
    /// Will use the conversion rate as of start_time.
    /// Optional. If not specified USD will be used.
    pub currency_code: std::string::String,

    /// Requested page size. Defaults to 5000.
    pub page_size: i32,

    /// A token identifying a page of results to return. This should be a
    /// `next_page_token` value returned from a previous `ListSkus`
    /// call. If unspecified, the first page of results is returned.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListSkusRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListSkusRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [start_time][crate::model::ListSkusRequest::start_time].
    pub fn set_start_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.start_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [start_time][crate::model::ListSkusRequest::start_time].
    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.start_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::ListSkusRequest::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::ListSkusRequest::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [currency_code][crate::model::ListSkusRequest::currency_code].
    pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.currency_code = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListSkusRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListSkusRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListSkusRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.ListSkusRequest"
    }
}

/// Response message for `ListSkus`.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListSkusResponse {
    /// The list of public SKUs of the given service.
    pub skus: std::vec::Vec<crate::model::Sku>,

    /// A token to retrieve the next page of results. To retrieve the next page,
    /// call `ListSkus` again with the `page_token` field set to this
    /// value. This field is empty if there are no more results to retrieve.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListSkusResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [skus][crate::model::ListSkusResponse::skus].
    pub fn set_skus<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Sku>,
    {
        use std::iter::Iterator;
        self.skus = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListSkusResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListSkusResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.billing.v1.ListSkusResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListSkusResponse {
    type PageItem = crate::model::Sku;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.skus
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}
